package cn.huijielong.modules.cm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.huijielong.common.utils.Query;
import cn.huijielong.modules.cm.dao.DictionaryDao;
import cn.huijielong.modules.cm.service.DictionaryService;
@Service("dictionaryService")
public class DictionaryServiceImpl implements DictionaryService {
	@Autowired
	private DictionaryDao dictionaryDao;
	
	@Override
	public List<Query> queryDictsByType(String type) {
		return dictionaryDao.queryDictsByType(type);
	}

	@Override
	public List<Query> queryDictsInTypes(String... types) {
		StringBuilder params=new StringBuilder();
		for(String p:types) {
			if(params.length()>0) {
				params.append(",");
			}
			params.append("'").append(p).append("'");
		}
		
		return dictionaryDao.queryDictsInTypes(params.toString());
	}

}
